﻿using System;
using System.Collections.Generic;
using System.Text;

using Discuz.Common;
using Discuz.Forum;
using Discuz.Entity;
using Discuz.Config;
using Discuz.Data;
using Discuz.Data.SqlServer;
using System.Data;
using System.Data.Common;

namespace Discuz.Web
{
    public class postvolunteer : Discuz.Forum.PageBase
    {

        private string name;
        private string qq;
        private int gender;
        private int retirement;
        private string education;
        private string email;
        private string phone;
        private string workunit;
        private string address;
        private string remarks;


        protected override void ShowPage()
        {

            if (base.ispost)
            {
                name = DNTRequest.GetString("name");
                
                qq = DNTRequest.GetString("qq");
                gender = DNTRequest.GetInt("gender", 0);
                retirement = DNTRequest.GetInt("retirement",0);
                education = DNTRequest.GetString("education");
                email = DNTRequest.GetString("email");
                phone = DNTRequest.GetString("phone");
                workunit = DNTRequest.GetString("workunit");
                address = DNTRequest.GetString("address");
                remarks = DNTRequest.GetString("remarks");

                //Discuz.Data.DbHelper.



                DbParameter[] parms = {
									   DbHelper.MakeInParam("@name",(DbType)SqlDbType.Char,20,name),
									   DbHelper.MakeInParam("@qq",(DbType)SqlDbType.Char,20,qq),
                                       DbHelper.MakeInParam("@gender",(DbType)SqlDbType.Bit,1,gender),
                                       DbHelper.MakeInParam("@retirement",(DbType)SqlDbType.Bit,1,retirement),
                                       DbHelper.MakeInParam("@education",(DbType)SqlDbType.Char,10,education),
                                       DbHelper.MakeInParam("@email",(DbType)SqlDbType.Char,50,email),
                                       DbHelper.MakeInParam("@phone",(DbType)SqlDbType.Char,20,phone),
                                       DbHelper.MakeInParam("@workunit",(DbType)SqlDbType.Char,200,workunit),
                                       DbHelper.MakeInParam("@address",(DbType)SqlDbType.Char,200,address),
                                       DbHelper.MakeInParam("@remarks",(DbType)SqlDbType.VarChar,2000,remarks)

								   };

                int id = TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.StoredProcedure,
                                                                        string.Format("{0}createvolunteer", BaseConfigs.GetTablePrefix),
                                                                     parms), -1);
                //return id;

           

        }

        }
    }
}
